<template>
	<view>
		<view class="arrivalNavigation" v-if="showHidden">
			<view class="d4"></view>
			<view class="sideNavigation">
				<view class="flex-xy-center" style="height: 80rpx;" v-for="(item,index) in btnList" :key="index"
					@click="btnClick(item)">
					<view class="liBottomBorder"></view>
					<view>{{ item.title }}</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import * as api from '@/api/order-api.js';

	export default {
		name: '',
		data() {
			return {

				showPayCost: false,
				payCostList: [],
				currentPayItem: null,
				showPopCost: false,
				chargeItemsTypes: [{
						value: 1,
						text: '按次'
					},
					{
						value: 2,
						text: '按天'
					},
					// {
					// 	value: 3,
					// 	text: '按里程'
					// }
				],
				customCost: {
					chargeProjectName: '',
					chargeMoney: '',
					chargeItemsType: 1,
					canEdit: 3,
					number: '1',
					unitPrice: ''

				},
			}
		},
		props: {
			orderInfo: {
				type: Object,
				default () {
					return {}
				}
			},
			customerInfo: {
				type: Object,
				default () {
					return {}
				}
			},
			showHidden: {
				type: Boolean,
				default: false
			}
		},
		computed: {
			btnList() {
				var btnList = [];
				if (this.checkPermi(['order:orderBasic:newExpenses']) && !this.orderInfo.previousOrderNumber) {
					btnList.push({
						title: '合同信息',
						code: 888,
						path: 'orderContract'

					})
				}
				if (this.checkPermi(['order:orderBasic:paymentOfFees']) && this.orderInfo.unpaidAmount > 0) {
					btnList.push({
						title: '费用缴纳',
						code: 100
					})
				}
				if (this.checkPermi(['order:orderBasic:newExpenses', 'order:orderBasic:addExpenses']) && !this.orderInfo
					.previousOrderNumber) {
					btnList.push({
						title: '租金调整',
						code: 200,
						path: 'orderRentReview'

					})
				}
				if (this.checkPermi(['member:basic:edit'])) {
					btnList.push({
						title: '客户信息',
						code: 666
				
					})
				}
				const orderStatus = this.orderInfo.orderStatus;
				var tmpList = []
				switch (orderStatus) {
					case 0: //待支付
						if (this.checkPermi(['order:orderBasic:cancel'])) {
							tmpList.push({
								title: '取消订单',
								code: 0,
								path: 'cancleOrder'
							})
						}
						if (this.checkPermi(['order:orderBasic:distribution'])) {
							tmpList.push({
								title: '订单分配',
								code: 1,
								path: 'staffAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:supplyCar'])) {
							tmpList.push({
								title: '订单排车',
								code: 2,
								path: 'carAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:edit']) && this.orderInfo.rentIspay == 1 && this.orderInfo
							.depositIspay == 1 && this.orderInfo.illegalIspay == 1 && !this.orderInfo.previousOrderNumber
							) {
							tmpList.push({
								title: '编辑订单',
								code: 300,
								path: ''
							})
						}

						break;
					case 1: //待分配
						if (this.checkPermi(['order:orderBasic:cancel'])) {
							tmpList.push({
								title: '取消订单',
								code: 0,
								path: 'cancleOrder'
							})
						}
						if (this.checkPermi(['order:orderBasic:distribution'])) {
							tmpList.push({
								title: '订单分配',
								code: 1,
								path: 'staffAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:supplyCar'])) {
							tmpList.push({
								title: this.orderInfo.carNo ? '重新排车': '订单排车',
								code: 2,
								path: 'carAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:edit']) && this.orderInfo.rentIspay == 1 && this.orderInfo
							.depositIspay == 1 && this.orderInfo.illegalIspay == 1 && !this.orderInfo.previousOrderNumber
							) {
							tmpList.push({
								title: '编辑订单',
								code: 300,
								path: ''
							})
						}
						break;
					case 2: //待排车
						if (this.checkPermi(['order:orderBasic:cancel'])) {
							tmpList.push({
								title: '取消订单',
								code: 0,
								path: 'cancleOrder'
							})
						}
						if (this.checkPermi(['order:orderBasic:supplyCar'])) {
							tmpList.push({
								title: '订单排车',
								code: 2,
								path: 'carAllocation'
							})
						};
						if (this.checkPermi(['order:orderBasic:distribution'])) {
							tmpList.push({
								title: '重新分配',
								code: 1,
								path: 'staffAllocation'
							})
						}

						if (this.checkPermi(['order:orderBasic:edit']) && this.orderInfo.rentIspay == 1 && this.orderInfo
							.depositIspay == 1 && this.orderInfo.illegalIspay == 1 && !this.orderInfo.previousOrderNumber
							) {
							tmpList.push({
								title: '编辑订单',
								code: 300,
								path: ''
							})
						}

						break;
					case 3: //待取车
						if (this.checkPermi(['order:orderBasic:cancel'])) {
							tmpList.push({
								title: '取消订单',
								code: 0,
								path: 'cancleOrder'
							})
						}
						if (this.checkPermi(['order:orderBasic:distribution'])) {
							tmpList.push({
								title: '重新分配',
								code: 1,
								path: 'staffAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:delivery'])) {
							tmpList.push({
								title: '交车验车',
								code: 3,
								path: 'deliveryAndInspection'
							})
						}
						if (this.checkPermi(['order:orderBasic:supplyCar'])) {
							tmpList.push({
								title: '重新排车',
								code: 2,
								path: 'carAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:edit']) && this.orderInfo.rentIspay == 1 && this.orderInfo
							.depositIspay == 1 && this.orderInfo.illegalIspay == 1 && !this.orderInfo.previousOrderNumber
							) {
							tmpList.push({
								title: '编辑订单',
								code: 300,
								path: ''
							})
						}
						break;
					case 4: //用车中
						if (this.checkPermi(['order:orderBasic:distribution'])) {
							tmpList.push({
								title: '重新分配',
								code: 1,
								path: 'staffAllocation'
							})
						}
						if (this.checkPermi(['order:orderBasic:alsoCarTest'])) {
							tmpList.push({
								title: '还车验车',
								code: 4,
								path: 'returnTheCarForInspection'
							})
						}
						if (this.checkPermi(['order:orderBasic:changeCar'])) {
							tmpList.push({
								title: '订单换车',
								code: 99,
								path: 'earlyReturnCar'
							})
						}
						if (this.checkPermi(['order:orderBasic:isEarlyReturn'])) {
							tmpList.push({
								title: '提前还车',
								code: 5,
								path: 'earlyReturnCar'
							})
						}
						if (this.checkPermi(['order:orderBasic:orderRenewal'])) {
							tmpList.push({
								title: '订单续租',
								code: 6,
								path: 'orderRelet'
							})
						}
						break;
					case 5: //车损结算
						if (this.checkPermi(['order:orderBasic:vehicleDamage'])) {
							tmpList.push({
								title: '车损结算',
								code: 9,
								path: 'carDamageSettlement'
							})
						}
						break;
					case 6: //押金结算
						if (this.checkPermi(['order:orderBasic:depositRefund'])) {
							tmpList.push({
								title: '押金结算',
								code: 7,
								path: 'depositSettlement'
							})
						}
						break;
					case 7: //违章处理
						if (this.checkPermi(['order:orderBasic:handViolations'])) {
							tmpList.push({
								title: '违章处理',
								code: 10,
								path: 'illegalProcessing'
							})
						}
						break;
					case 8: //违章结算
						if (this.checkPermi(['order:orderBasic:IllegalProcessing'])) {
							tmpList.push({
								title: '违章结算',
								code: 8,
								path: 'illegalSettlement'
							})
						}
						break;
					default:
						break;
				}
				btnList = btnList.concat(tmpList);

				return btnList;
			}
		},
		mounted() {

		},
		methods: {
			btnClick(btnInfo) {
				this.$emit('clickOpItem', btnInfo);

			},
		}

	}
</script>

<style lang="scss" scoped>
	.arrivalNavigation {
		width: 250rpx;
		position: fixed;
		top: 95rpx;
		right: 20rpx;
		z-index: 999;

		.sideNavigation {
			width: 248rpx;
			background-color: #202020;
			color: #eee;
			border-radius: 10rpx;

			li {
				height: 85rpx;
				text-align: center;
				line-height: 85rpx;
				font-size: 25rpx;
			}

			.liBottomBorder {
				border: 1rpx solid #373737;
			}

		}

		.d4 {
			// position: absolute;
			//  	left: 140rpx;
			width: 0;
			height: 0;
			margin-left: 150rpx;
			margin-top: -20rpx;
			border-width: 20rpx;
			border-style: solid;
			border-color: transparent #333 transparent transparent;
			transform: rotate(90deg);
			/*顺时针旋转90°*/

		}
	}

	.payCostItem {
		height: 80rpx;
		width: 600rpx;
		border-bottom: 1rpx solid #ededed;
	}

	.alertBtn {
		width: 200rpx;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		background-color: #1673FF;
		color: #fff;
		border-radius: 8rpx;
		font-size: 28rpx;
	}

	.commitBtn {
		background-color: #1673ff;
		border-radius: 12rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		color: #fff;
		width: 300rpx;
		margin-top: 30rpx;
	}
</style>